﻿using DataTurnClient.Enum;
using DataTurnClient.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataTurnClient.Interface
{
    public interface ITool
    {
        /// <summary>
        /// 设置文件路径转实体列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filePath"></param>
        /// <returns></returns>
        T JsonToList<T>(string filePath);

        /// <summary>
        /// 任务预览弹窗
        /// </summary>
        /// <param name="job"></param>
        /// <returns></returns>
        string MsgShow(Job job);

        /// <summary>
        /// 日志预览弹窗
        /// </summary>
        /// <param name="job"></param>
        /// <returns></returns>
        string LogShow(Log log);

        /// <summary>
        /// xml读取
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        Result<string> XmlRead(string name);

        /// <summary>
        /// xml写入
        /// </summary>
        /// <param name="key"></param>
        /// <param name="keyName"></param>
        /// <returns></returns>
        Result<string> XmlWrith(string key, string keyName);

        /// <summary>
        /// 发送接口请求
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="data"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        Result<T> PostRequest<T>(string url, T data, DType.RequestType type);

        /// <summary>
        /// 核心方法，任务执行
        /// </summary>
        /// <param name="jobList"></param>
        /// <param name="setList"></param>
        /// <param name="sender"></param>
        /// <returns></returns>
        Result<string> Execute(List<Job> jobList, List<RouteLine> setList, object sender);

        /// <summary>
        /// 核心方法，检查任务运行星期内
        /// </summary>
        /// <param name="jobWeek"></param>
        /// <returns></returns>
        bool IsWeek(string jobWeek);

        /// <summary>
        /// 核心方法，检查是否在任务运行秒时分内
        /// </summary>
        /// <param name="jobTimeList"></param>
        /// <param name="newTime"></param>
        /// <returns></returns>
        bool IsTime(List<JobTime> jobTimeList, List<string> newTime);

        /// <summary>
        /// txt写入
        /// </summary>
        /// <param name="txtName"></param>
        /// <param name="txt"></param>
        void WriterText(string txtName, string txt);

        /// <summary>
        /// 检查控件内控件数值是否为空，此方法如果需要设置不验证的控件，需要在控件的Tag属性填入True。
        /// </summary>
        /// <param name="controls"></param>
        /// <returns></returns>
        bool CheckControlData(System.Windows.Forms.Control controls);

    }
}
